<html>
<head>
    <title>双预防系统</title>
    <link rel="stylesheet" href="../../../assets/bundle.element.css">
    <link rel="stylesheet" href="../../../style.css">
    <link rel="stylesheet" href="../../../swipebox.css">
    <style>
        body {
            background: #F0F2F6;
        }

        .main-head {
            background: #fff;
            padding-left: 10px;
            padding-top: 10px;
            margin-bottom: 0px;
            border: solid 1px #fff;
        }

        .chart-outer {
            height: 200px;
        }

        .inputW {
            width: 150px;
        }

        .itemW {
            width: 200px;
        }

        .formLabelWidth {
            width: 100px;
        }

        .popClass {
            height: 400px;
        }

        tr td:first-child {
            width: 100px;
        }
    </style>
</head>
<body>
<div class="page" id="page-monitor">
    <div class="page-title">隐患排查台账,风险巡查</div>
    <div class="page-main">
        <el-row>
            <el-col :span="24">
                <div class="main-head">
                    <el-form :inline="true" size="small">
                        <el-form-item label="人员名称">
                            <el-input placeholder="请输入" class="inputW" v-model="userName"></el-input>
                        </el-form-item>
                        <el-form-item label="部门">
                            <el-select v-model="departmentId" style="width: 200px">
                                <el-option
                                        v-for="item in DepartmentData"
                                        :key="item.DepartmentID"
                                        :label="item.DepartmentName"
                                        :value="item.DepartmentID">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item>
                            <el-button type="primary" @click="search">查询</el-button>
                        </el-form-item>
                    </el-form>
                </div>
                <template v-if="tableData">
                    <el-table :data="tableData" style="margin-bottom: 40px" :stripe="true" :border="true" size="mini"
                              style="width: 100%">
                        <el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
                        <el-table-column prop="userName" label="人员名称"></el-table-column>
                        <el-table-column prop="DepartmentName" label="部门"></el-table-column>
                        <el-table-column prop="Telephone" label="联系方式"></el-table-column>
                        <el-table-column prop="DocCount" label="公文数"></el-table-column>
                    </el-table>
                </template>
                <div class="page-footer">
                    <el-pagination background layout="prev, pager, next" :pagesize="pagesize" :total="totalCount"
                                   :current-page.sync="pageno" @current-change="onChangePage">
                    </el-pagination>
                </div>
            </el-col>
        </el-row>
        <el-row>
        </el-row>
    </div>
</div>
<script type='text/javascript' src='../../../assets/bundle.js' charset='utf-8'></script>
<script type='text/javascript' src='../../../assets/jquery-1.11.2.min.js' charset='utf-8'></script>
<script type='text/javascript' src='../../../assets/jquery.swipebox.min.js' charset='utf-8'></script>
<script type='text/javascript' src='../../../assets/echarts.min.js' charset='utf-8'></script>
<script type='text/javascript' src='../../../js/common.js' charset='utf-8'></script>
<script type='text/javascript' src='../../../js/component.js' charset='utf-8'></script>
<script>
    $(function ($) {
        $(".swipebox").swipebox();
    })
    var vuePage = new Vue({
        el: '#page-monitor',
        data: {
            zone:'',
            month: '',
            formLabelWidth: '120px',
            currentPage: 1,
            tableData: [],
            pagesize: 10,
            pageno: 1,
            totalCount: 0,
            projectNo: '',
            userName: '',
            CheckprojectName: '',
            editMod: false,
            DetailData: [],
            Dpagesize: 10,
            Dpageno: 1,
            DtotalCount: 0,
            detailFormVisible: false,
            pointData: [{Name: '所有', Id: -1}, {Name: '风险', Id: 0}, {Name: '设备', Id: 1}],
            flagData: [{Name: '所有', Id: -1}, {Name: '未巡检', Id: 0}, {Name: '已巡检', Id: 2}, {Name: '超时未巡检', Id: 3}],
            DepartmentData:[],
            departmentId:''
        },
        created: function () {
            this.month = TimeUtil.convertToString(new Date()).substr(0, 7);
            HttpUtil.get('Department/List', {UserId: SiteConfig.account.id}).success((r) => {
                if (r.state == 0) {
                    vuePage.DepartmentData = r.data;
                }
            })
            this.loadData();
        },
        methods: {
            p(s) {
                return s < 10 ? '0' + s : s
            },
            ToDate() {
                const d = new Date(this.month);
                const resDate = d.getFullYear() + '-' + this.p((d.getMonth() + 1)) + '-' + this.p(d.getDate());
                const resTime = this.p(d.getHours()) + ':' + this.p(d.getMinutes()) + ':' + this.p(d.getSeconds());
                return resDate;
            },
            loadData: function () {
                var param = {};
                if (this.userName)
                    param.userName = this.userName;
                if (this.departmentId)
                    param.departmentId = this.departmentId;
                // if (this.zone)
                //     param.zone = this.zone;
                // param.wf_tasktime = this.ToDate();
                param.UserId = SiteConfig.account.id;
                param.pageno = this.pageno;
                param.pagesize = this.pagesize;
                HttpUtil.get('GovernmentDoc/getPersonnelByDoc', param).success((res) => {
                     var userData= res.data;
                    vuePage.totalCount = res.total;
                    var DepartmentData = this.DepartmentData;
                    for (var i = 0; i < userData.length; i++) {
                        for (var j = 0; j < DepartmentData.length; j++) {
                            if (userData[i].departmentId == DepartmentData[j].DepartmentID) {
                                userData[i].DepartmentName = DepartmentData[j].DepartmentName;
                            }
                        }
                    }
                    vuePage.tableData=userData;

                });
            },
            exportData() {
                var param = {};
                param.projectNo = SiteConfig.account.projectNo;
                HttpUtil.get('Patrolexcute/ExportRiskCheck', param).success((res) => {
                    this.$message.success('导出成功');
                    window.location = SiteConfig.webApiset + res.data;
                })
            },
            onChangePage(page) {
                this.pageno = page;
                this.loadData();
            },
            search: function () {
                this.pageno = 1;
                this.loadData();

            },
            onCheckbox: function (row) {
            },
        },
        mounted: function () {
            this.imageUrl = SiteConfig.webApiset;
        }
    });
</script>
</body>
</html>
